package com.purvar;

import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;

import java.util.Collections;

@SpringBootApplication
//@ComponentScan(basePackages = {"com.lemon","org.flowable.ui.modeler","org.flowable.ui.common"})
@ComponentScan(basePackages = {"com.purvar","org.flowable.ui.modeler","org.flowable.ui.common"})
public class FlowBootApplication {
    public static void main(String[] args) {
        SpringApplication.run(FlowBootApplication.class,args);
    }

    @Bean
    CommandLineRunner startProcess(final RuntimeService runtimeService, final TaskService taskService) {
        return new CommandLineRunner() {
            @Override
            public void run(String... strings) throws Exception {
               /* for (int i = 0; i < 2; i++)
                    runtimeService.startProcessInstanceByKey("waiter", Collections.singletonMap("customerId", (Object) i));

                for (int i = 0; i < 1; i++)
                    taskService.complete(taskService.createTaskQuery().list().get(0).getId());*/
                System.out.println("start");
            }
        };
    }
}
